package adkr

import (
    "sync/atomic"
    "time"
)

var abaTickNs int64 = int64(10 * time.Millisecond)
var abaRoundTONs int64 = int64(3 * time.Second)
var abaMaxRounds int64 = 10

func SetABATiming(tick time.Duration, roundTO time.Duration) {
    atomic.StoreInt64(&abaTickNs, int64(tick))
    atomic.StoreInt64(&abaRoundTONs, int64(roundTO))
}

func getABATick() time.Duration    { return time.Duration(atomic.LoadInt64(&abaTickNs)) }
func getABARoundTO() time.Duration { return time.Duration(atomic.LoadInt64(&abaRoundTONs)) }
func getABAMaxRounds() int         { return int(atomic.LoadInt64(&abaMaxRounds)) }

// Optional: set max ABA rounds
func SetABAMaxRounds(max int) { if max > 0 { atomic.StoreInt64(&abaMaxRounds, int64(max)) } }


